﻿
namespace LibraryTest.Models.Navigation
{
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using Library.Navigation;
    using System.Runtime.Serialization;
    using System.Collections.Generic;

    [DataContract]
    public class Page2Parameter : NavigationParameter
    {
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string Title { get; set; }

        [DataMember]
        public CustomValue CustomValue { get; set;  }

        public override bool AllowInitializingFromUri
        {
            get
            {
                return true;
            }
        }

        public override void InitializeFromUriParameters(Dictionary<string, string> parameters)
        {
            if (parameters.ContainsKey("id"))
            {
                this.Id = Int32.Parse(parameters["id"]);
            }

            if (parameters.ContainsKey("title"))
            {
                this.Title = parameters["title"];
            }
        }
    }

    [DataContract]
    public class CustomValue
    {
        [DataMember]
        public int InternalId { get; set; }

        [DataMember]
        public string InternalTitle { get; set; }
    }
}
